package com.vue.admin.service.impl;

import com.vue.admin.entity.SysRole;
import com.vue.admin.entity.SysUserRole;
import com.vue.admin.entity.SysUserRoleExample;
import com.vue.admin.mapper.SysUserRoleMapper;
import com.vue.admin.service.SysUserRoleService;
import com.vue.admin.util.StringUtil;
import com.vue.admin.util.UUIDUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

@Service
public class SysUserRoleServiceImpl implements SysUserRoleService {

    @Autowired
    private SysUserRoleMapper sysUserRoleMapper;

    public List<SysUserRole> selectByCondition(SysUserRoleExample example) {
        return sysUserRoleMapper.selectByExample(example);        //全部商品
    }

    @Transactional
    public boolean save(SysUserRole sysUserRole) {
        return sysUserRoleMapper.insert(sysUserRole) > -1;
    }


    @Transactional
    public boolean delete(SysUserRole sysUserRole) {
        return sysUserRoleMapper.deleteByPrimaryKey(sysUserRole.getUserId(), sysUserRole.getRoleId()) > -1;
    }
}
